package vip.xiaonuo.core.pojo.httpclient;

import lombok.Data;
import lombok.experimental.Accessors;

import java.util.LinkedHashMap;

@Data
@Accessors(chain = true)
public class ReturnJson {

    private String code;
    private String msg;
    private LinkedHashMap<String, Object> data = new LinkedHashMap<>();

    public void put(String key, Object value) {
        data.put(key, value);
    }

    public void remove(String key) {
        data.remove(key);
    }


    public LinkedHashMap<String, Object> getData() {
        return data;
    }

    public void setData(LinkedHashMap<String, Object> data) {
        this.data = data;
    }



    public void setData(String key, Object value) {
        this.data.put(key, value);
    }

    public void success(String key, Object value) {
        this.code = "200";
        this.msg = "success";
        this.setData(key, value);
    }


    public void failed(String key, Object value) {
        this.code = "500";
        this.msg = "filed";
        this.setData(key, value);
    }
}
